<?php
declare (strict_types=1);
namespace app\serviceapp;

use app\model\UserRegister;
use app\traits\ServiceTrait;
use app\service\AuthGroupService;
use think\facade\Db;

/**
 * 用户
 * Class UserRegisterService
 * @package app\service
 */
class UserRegisterService
{
    /**
     * 注册
     * @param $phone
     */
    public static function registerByPhone($phone)
    {
        $insert_data = [
            "phone" => $phone,
        ];
        $userTable = UserRegister::$_table;
        $userid = Db::name($userTable)->insertGetId($insert_data);
        return $userid;
    }

    /**
     * 按union_id注册
     * @param $unionid
     * @return int|string
     */
    public static function registerByUnionId($unionid)
    {
        $insert_data = [
            'uid' => $unionid,
        ];
        $userTable = UserRegister::$_table;
        $userid = Db::name($userTable)->insertGetId($insert_data);
        return $userid;
    }
}
